// 2014-02-01 Tyrghen
//---------------------------------------------
// Usage:
//  [] call edt_fnc_;
//---------------------------------------------
// Purpose:
// 
// 
// Parameters:
// - 
//
// Returns:
// 
//---------------------------------------------
// Objectif:
// 
//
// Paramètres:
// - 
//
// Renvoie:
// 
//---------------------------------------------

//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "editor\fn_attack.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>


TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_group","_position","_radius"];
DEFAULT_PARAM(_group,0,grpNull);
DEFAULT_PARAM(_position,1,ARR_3(0,0,0));
DEFAULT_PARAM(_radius,2,0);

if (IS_OBJECT(_group)) then {
	_group = group _group;
};
if (!IS_GROUP(_group)) then { _group = grpNull };
if (OR_ELSE(!IS_SCALAR(_radius),(_radius <= 0))) then {
	_radius = 0;
};
if (AND_ALSO(IS_STRING(_position),IS_MARKER(_position))) then {
	if (_radius <= 0) then {
		_radius = ((markerSize _position) select 0) max ((markerSize _position) select 1);
	};
	_position = markerPos _position;
};
if (_radius <= 30) then { _radius = 100 };

if (!IS_ARRAY(_position)) then {
	_position = [];
};

if (!isnull _group && count _position == 3) then {
	[_group,_position,_radius] call FFUNC(attack);
} else {
	ERROR("Invalid Parameters");
};

TRACE("End");
TMFPROFILERSTOP;